import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/toast/i_toast.dart';
import 'package:flutter_demo/utils/context/one_context_utils.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
///@date:  2024/1/18
///@author:  Administrator
///@description: Toast实现类
class ToastImpl extends IToast{
  @override
  void show(String text, {bool isShowLong = false}) {
    if (text.isNotEmpty) {
      showToast(text,
          context: OneContextUtils.context,
          animation: StyledToastAnimation.slideFromBottom,
          reverseAnimation: StyledToastAnimation.slideToBottom,
          startOffset: const Offset(0.0, 3.0),
          reverseEndOffset: const Offset(0.0, 3.0),
          position: StyledToastPosition.bottom,
          duration: Duration(seconds: isShowLong ? 4 : 2),
          //Animation duration   animDuration * 2 <= duration
          animDuration:  const Duration(seconds: 1),
          curve: Curves.elasticOut,
          reverseCurve: Curves.fastOutSlowIn);
    }
  }
}
  